-
Notifications
You must be signed in to change notification settings - Fork 1.2k
add cua replay example script #1162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Overview
Greptile Summary
Refactored the CUA replay example to demonstrate cache performance benefits by executing the same task twice - first to build the cache, then to replay from cache. The script now includes performance metrics showing duration comparison, time saved, and speedup percentage between cold and cached runs.
- Extracted logic into
runDemo()function that runs twice with different cache states - Added performance tracking with start/end timestamps
- Replaced drag-drop demo with login flow demo using modern login site
- Added formatted console output showing performance comparison table
- Imported
v3Loggeranddotenvfor logging and environment configuration
Issue Found:
- Typo in email address (
browserbaser.cominstead ofbrowserbase.com)
Confidence Score: 4/5
- Safe to merge after fixing the email typo - this is an example script demonstrating cache functionality
- Minor syntax error (typo) that needs correction but doesn't affect the core demonstration logic. The refactoring improves the example by clearly showing cache benefits with performance metrics.
- packages/core/examples/v3/cuaReplay.ts - fix email typo on line 36
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| packages/core/examples/v3/cuaReplay.ts | 4/5 | Refactored example to demonstrate CUA cache performance by running two passes and comparing execution times. Contains typo in email address that should be fixed. |
Sequence Diagram
sequenceDiagram
participant User
participant Main
participant RunDemo1 as runDemo(1)
participant V3_1 as V3 Instance 1
participant Agent1 as Agent (CUA)
participant Cache
participant RunDemo2 as runDemo(2)
participant V3_2 as V3 Instance 2
participant Agent2 as Agent (CUA)
User->>Main: Execute main()
Main->>RunDemo1: await runDemo(1)
RunDemo1->>V3_1: new V3({ cacheDir: "cua-agent-cache" })
RunDemo1->>V3_1: init()
V3_1->>RunDemo1: Browser context ready
RunDemo1->>Agent1: agent({ cua: true })
RunDemo1->>Agent1: execute(instruction)
Agent1->>Cache: Write actions (BUILDING CACHE)
Agent1->>RunDemo1: Result + duration
RunDemo1->>Main: metrics1 (cold run)
Main->>Main: Wait 2 seconds
Main->>RunDemo2: await runDemo(2)
RunDemo2->>V3_2: new V3({ cacheDir: "cua-agent-cache" })
RunDemo2->>V3_2: init()
V3_2->>RunDemo2: Browser context ready
RunDemo2->>Agent2: agent({ cua: true })
RunDemo2->>Agent2: execute(instruction)
Agent2->>Cache: Read cached actions (USING CACHE)
Cache->>Agent2: Replay actions (no LLM calls)
Agent2->>RunDemo2: Result + duration
RunDemo2->>Main: metrics2 (cached run)
Main->>User: Performance comparison table
1 file reviewed, 1 comment
why
Update example script to show benefits from using cached actions
image of what the final log looks like

what changed
test plan